<template>
	<view class="section marketing-games">
		<view class="section-title">
			<text class="title-text">营销游戏</text>
			<text class="more" @click="navigateToMore">更多 ></text>
		</view>
		<view class="games-grid">
			<view class="game-item" v-for="game in games" :key="game.id" @click="navigateToGame(game)">
				<image :src="game.icon" mode="aspectFit" class="game-icon"></image>
				<text class="game-name">{{game.name}}</text>
				<text class="game-desc">{{game.desc}}</text>
				<view class="game-reward" v-if="game.reward">
					<text class="reward-text">{{game.reward}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue'

// 游戏列表数据
const games = ref([
	{
		id: 1,
		name: '幸运大转盘',
		desc: '转盘抽奖赢好礼',
		icon: '/static/icons/games/wheel.svg',
		reward: '最高可得88元',
		path: '/pages/games/wheel'
	},
	{
		id: 2,
		name: '砸金蛋',
		desc: '砸开金蛋赢大奖',
		icon: '/static/icons/games/egg.svg',
		reward: '最高可得66元',
		path: '/pages/games/egg'
	},
	{
		id: 3,
		name: '刮刮乐',
		desc: '刮开涂层赢好礼',
		icon: '/static/icons/games/scratch.svg',
		reward: '最高可得50元',
		path: '/pages/games/scratch'
	},
	{
		id: 4,
		name: '集福卡',
		desc: '集齐福卡赢大奖',
		icon: '/static/icons/games/cards.svg',
		reward: '最高可得100元',
		path: '/pages/games/cards'
	},
	{
		id: 5,
		name: '摇一摇',
		desc: '摇手机赢好礼',
		icon: '/static/icons/games/shake.svg',
		reward: '最高可得30元',
		path: '/pages/games/shake'
	},
	{
		id: 6,
		name: '签到抽奖',
		desc: '每日签到赢大奖',
		icon: '/static/icons/games/sign.svg',
		reward: '最高可得20元',
		path: '/pages/games/sign'
	}
])

// 跳转到游戏页面
const navigateToGame = (game) => {
	uni.navigateTo({
		url: game.path
	})
}

// 跳转到更多页面
const navigateToMore = () => {
	uni.navigateTo({
		url: '/pages/games/index'
	})
}
</script>

<style>
.section {
	background-color: #FFFFFF;
	padding: 20rpx;
	margin-bottom: 20rpx;
}

.section-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20rpx;
}

.title-text {
	font-size: 32rpx;
	font-weight: bold;
	color: #333;
	padding-left: 20rpx;
	border-left: 8rpx solid #D02B29;
}

.more {
	font-size: 24rpx;
	color: #999;
}

.games-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20rpx;
	padding: 0 10rpx;
}

.game-item {
	background-color: #F8F8F8;
	border-radius: 12rpx;
	padding: 20rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
}

.game-icon {
	width: 100rpx;
	height: 100rpx;
	margin-bottom: 10rpx;
	display: flex;
	align-items: center;
	justify-content: center;
}

.game-name {
	font-size: 28rpx;
	font-weight: bold;
	color: #333;
	margin-bottom: 6rpx;
}

.game-desc {
	font-size: 24rpx;
	color: #666;
	margin-bottom: 10rpx;
}

.game-reward {
	background-color: #FFE4E4;
	padding: 4rpx 12rpx;
	border-radius: 20rpx;
}

.reward-text {
	font-size: 22rpx;
	color: #D02B29;
}
</style> 